package com.cuckoo.mall.thus.menuaccount.login;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.bgn.baseframe.base.MVPBaseActivity;
import com.bgn.baseframe.utils.ToastUtil;
import com.cuckoo.mall.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;



/**
 * 作者：wl on 2018/4/ * 邮箱：wanglun@stosz.com
 */
@Route(path = "/mall/loginActivity", group = "mall")
public class LoginAndRegisterActivity extends MVPBaseActivity<LoginContract.View, LoginPresenter> implements LoginContract.View {

    @BindView(R.id.lly_facebook)
    LinearLayout lly_facebook;
    @BindView(R.id.tv_turn_signup)
    TextView tvTurnSignup;
    @BindView(R.id.tv_turn_login)
    TextView tvTurnLogin;
    @BindView(R.id.lly_initpage)
    LinearLayout llyInitpage;

    @BindView(R.id.lly_swich)
    LinearLayout llySwich;
    /*content布局*/


    @BindView(R.id.iv_close)
    ImageView ivClose;

    /*是否初始化内容布局*/ boolean isContentInit = false;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setIsLoadTitleBar(false);

        setContentView(R.layout.activity_login_register);
        getStateBar().hide();
        ButterKnife.bind(this);


    }


    @OnClick({R.id.iv_close, R.id.lly_facebook, R.id.tv_turn_signup, R.id.tv_turn_login, R.id.tv_swich_signup, R.id.tv_swich_login})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_close:
                finish();
                break;

            case R.id.lly_facebook:

                showLoadingView();

                break;
            case R.id.tv_swich_signup:
            case R.id.tv_turn_signup:
                break;
            case R.id.tv_turn_login:
            case R.id.tv_swich_login:
                break;
        }
    }


    public void handleSwichStuff() {
        if (!isContentInit) {
            isContentInit = true;
            llyInitpage.setVisibility(View.GONE);
            llySwich.setVisibility(View.VISIBLE);

        }


    }


    @Override
    protected void onDestroy() {

        super.onDestroy();
    }

    @Override
    public void onLoginSucceed() {
        ToastUtil.showInfo(getString(R.string.login_succeed));
        finish();
    }

    @Override
    public void onRegisterSucceed() {
        finish();
    }
}
